﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Satker.aspx.vb" Inherits="bisaska.Satker" %>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<form id="form1" runat="server">
<asp:ScriptManager ID="DivisiScriptManager" runat="server" EnablePartialRendering="true" EnablePageMethods="true"/>
<asp:UpdatePanel ID="up" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" 
              runat="server" 
              AutoGenerateColumns="False"
              DataKeyNames="id_satker" 
              DataSourceID="T_MST_SATKER" 
              AllowPaging="True" 
              AllowSorting="True" 
              CellPadding="4" 
              GridLines="None" 
              AlternatingRowStyle-CssClass="odd"
              CssClass="table-data">
  <Columns>
    <asp:BoundField DataField="id_satker" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="id_satker" />
    <asp:BoundField DataField="kode_satker" HeaderText="Kode Satker" SortExpression="kode_satker" />
    <asp:BoundField DataField="nama_satker" HeaderText="nama_satker" SortExpression="nama_satker" />
    <asp:BoundField DataField="telp" HeaderText="telp" SortExpression="Telepon" />
    <asp:BoundField DataField="lokasi_satker" HeaderText="lokasi_satker" SortExpression="lokasi_satker" />
    <asp:BoundField DataField="is_active" HeaderText="Status" SortExpression="status" />
    <asp:BoundField DataField="tgl_update" HeaderText="Tanggal Update" SortExpression="tgl_update" />
    <asp:CommandField SelectText="Edit" ShowSelectButton="True" />
    <asp:TemplateField>
      <ItemTemplate>
        <asp:LinkButton ID="deleteButton" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Hapus data?');" />
      </ItemTemplate>
    </asp:TemplateField>
    <asp:ButtonField CommandName="btnCopy" Text="Copy" />
  </Columns>
</asp:GridView>
<div class="paging">
  <em><asp:Button ID="Button3" runat="server" Text="Add New" CausesValidation="False" CssClass="button"/></em><div style="clear:both;"></div>
</div> 
<table id="tabel1" runat="server" cellpadding="0" cellspacing="2" border="0" class="table-form">
  <tr>
    <th>Kode Satker</th>
    <td>
      <asp:TextBox ID="textbox1" runat="server" MaxLength="12"></asp:TextBox>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="textbox1" ErrorMessage="*"></asp:RequiredFieldValidator>
    </td>
  </tr>
  <tr>
    <th>Nama Satker</th>
    <td>
      <asp:TextBox ID="textbox4" runat="server" MaxLength="80"></asp:TextBox>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="textbox4" ErrorMessage="*"></asp:RequiredFieldValidator>
    </td>
  </tr>
  <tr>
    <th>Telepon</th>
    <td>
      <asp:TextBox ID="textbox2" runat="server" MaxLength="9" Width="121px"></asp:TextBox>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="textbox2" ErrorMessage="*"></asp:RequiredFieldValidator>
      <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="textbox2" Display="Dynamic" 
                        ErrorMessage="Data Harus Angka 6-9 Digit" ForeColor="Red" 
                        ValidationExpression="^[0-9]{6,9}$" EnableTheming="True">
      </asp:RegularExpressionValidator>
    </td>
  </tr>
  <tr>
    <th>Lokasi</th>
    <td>
      <asp:TextBox ID="textbox3" runat="server" CssClass="textbox" MaxLength="80"></asp:TextBox>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="textbox3" ErrorMessage="*"></asp:RequiredFieldValidator>
    </td>
  </tr>
  <tr>
    <th>Status</th>
    <td>
      <asp:DropDownList ID="dropdownlist2" runat="server">
        <asp:ListItem Value="0">Aktif</asp:ListItem>
        <asp:ListItem Value="1">Pasif</asp:ListItem>
      </asp:DropDownList>
    </td>
  </tr>
  <tr>
    <td></td>
    <td>
      <asp:Button ID="button1" runat="server" Text="Save" CssClass="button"></asp:Button>
      <asp:Button ID="button2" runat="server" Text="Cancel" CssClass="button" CausesValidation="False"></asp:Button>
    </td>
  </tr>
</table>        
<asp:SqlDataSource ID="T_MST_SATKER" runat="server" 
    ConnectionString="<%$ ConnectionStrings:bisaska %>" 
    SelectCommand="select id_satker,kode_satker,nama_satker,telp,lokasi_satker,is_active = case is_active when 0 then 'Aktif' else 'Pasif' end ,tgl_update from T_MST_SATKER"
    DeleteCommand="DELETE FROM [T_MST_Satker] WHERE [id_satker] = @id_satker">
    <DeleteParameters>
      <asp:Parameter Name="id_satker" Type="Int64" />
    </DeleteParameters>
</asp:SqlDataSource>            
</ContentTemplate>
</asp:UpdatePanel>   
</form>
</asp:Content>
